//Headers
#include "funcs.h"
#include <sstream>
#include <string>
#include <vector>

int s2i( const string Text )//Text not by const reference so that the function can be used with a
{                           //character array as argument
    int Num;
	stringstream out;
	out << Text;
	out >> Num;
	return Num;
}

string i2s(const int Num)
{
	string Text;
	stringstream out;
	out << Num;
	out >> Text;
	return Text;
}

vector<int> split5by4(string nsplit)
{
    vector<int> splitted;
    //get values
    splitted.push_back(s2i(nsplit.substr(0,4)));
    splitted.push_back(s2i(nsplit.substr(5,4)));
    splitted.push_back(s2i(nsplit.substr(10,4)));
    splitted.push_back(s2i(nsplit.substr(15,4)));
    splitted.push_back(s2i(nsplit.substr(20,4)));

    return splitted;
}

vector<int> split4by4(string nsplit)
{
    vector<int> splitted;
    //get values
    splitted.push_back(s2i(nsplit.substr(0,4)));
    splitted.push_back(s2i(nsplit.substr(5,4)));
    splitted.push_back(s2i(nsplit.substr(10,4)));
    splitted.push_back(s2i(nsplit.substr(15,4)));

    return splitted;
}

vector<int> split2by4(string nsplit)
{
    vector<int> splitted;
    //get values
    splitted.push_back(s2i(nsplit.substr(0,4)));
    splitted.push_back(s2i(nsplit.substr(5,4)));

    return splitted;
}
